<!-- 处理弹窗 -->

<template>
  <WebModal path="deal" :title="title" :small="isCommon" :noCancel="isRepair && add_one.step > 1">
    <RepairForm v-if="isRepair" />

    <AlarmCommon v-if="isCommon" />

    <template #footer>
      <RepairFooter v-if="isRepair" />
    </template>
  </WebModal>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'DealModal',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb('deal'), CORE.mixWeb('add', 'add_')],

  /**
   * 组件导入 (Abc.vue + Abc/index.vue)
   */
  ...CORE.components(require.context('./', true, /vue$/)),

  /**
   * 计算属性 (慎用箭头函数)
   */
  computed: {
    /**
     * 是否为转工单
     */
    isRepair() {
      const { dealType } = this.one
      return dealType === 1
    },

    /**
     * 是否为通用
     */
    isCommon() {
      const { dealType } = this.one
      return dealType !== 1
    },

    /**
     * 标题
     */
    title() {
      const { isRepair } = this
      return isRepair ? `${CORE.MAP.ALARM}转工单` : `${CORE.MAP.ALARM}处理`
    },
  },
}
</script>
